/*
 * Sesame Inc.
 * Copyright (c) 2009 All Rights Reserved.
 */
package com.sesame.daoimpl;

import java.util.List;

import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import com.sesame.dao.CollectDAO;
import com.sesame.domain.Collect;

/**
 * @author voidman
 * 
 */
public class CollectDAOImpl extends SqlMapClientDaoSupport implements
        CollectDAO {

    public void addCollect(Collect Collect) {
        getSqlMapClientTemplate().insert("addCollect", Collect);
    }

    public void deleteCollectById(Integer id) {
        getSqlMapClientTemplate().delete("deleteCollectById", id);
    }

    @SuppressWarnings("unchecked")
    public List<Collect> getAllCollect() {
        return (List<Collect>) getSqlMapClientTemplate().queryForList(
                "getAllCollect");
    }

    public Collect getCollectById(Integer id) {
        return (Collect) getSqlMapClientTemplate().queryForObject(
                "getCollectById", id);
    }

    public Collect getCollectByImageId(Collect collect) {
        return (Collect) getSqlMapClientTemplate().queryForObject(
                "getCollectByImageId", collect);
    }

    public void updateCollect(Collect Collect) {
        getSqlMapClientTemplate().update("updateCollect", Collect);
    }

    public List<Collect> getCollectByUserId(Integer userId) {
        return (List<Collect>) getSqlMapClientTemplate().queryForList(
                "getCollectByUserId", userId);
    }

    public List<Collect> getTopCollectByUserId(Integer userId) {
        return (List<Collect>) getSqlMapClientTemplate().queryForList(
                "getTopCollectByUserId", userId);
    }

}